package com.mvc.user.action;

import javax.servlet.http.HttpServletRequest;

import com.mvc.anocation.Action;
import com.mvc.anocation.Mapping;
import com.mvc.user.form.LoginForm;

@Action("loginAction")
public class LoginAction {

	@Mapping("login")
	public String login(HttpServletRequest request, LoginForm loginForm) {
		String name = loginForm.getUsername();
		String pwd = loginForm.getUserpwd();
		if ("admin".equals(name) && "123".equals(pwd)) {
			request.setAttribute("success", "登陆成功！");
			return "/success.jsp";
		} else {
			request.setAttribute("error", "登陆失败！");
			return "/error.jsp";
		}
	}
}
